<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>自定義代碼配色 | Xing's Blog</title><meta name="author" content="xing"><meta name="copyright" content="xing"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="自定義代碼配色">
<meta property="og:type" content="article">
<meta property="og:title" content="自定義代碼配色">
<meta property="og:url" content="https://veryxing.github.io/article/b37b5fe3.html">
<meta property="og:site_name" content="Xing&#39;s Blog">
<meta property="og:description" content="自定義代碼配色">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://oss.012700.xyz/butterfly/2024/09/CODE-COLOR-COVER.png">
<meta property="article:published_time" content="2020-06-13T12:41:59.000Z">
<meta property="article:modified_time" content="2024-10-31T15:01:19.703Z">
<meta property="article:author" content="xing">
<meta property="article:tag" content="教程">
<meta property="article:tag" content="Hexo">
<meta property="article:tag" content="主題">
<meta property="article:tag" content="butterfly">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://oss.012700.xyz/butterfly/2024/09/CODE-COLOR-COVER.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://veryxing.github.io/article/b37b5fe3.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><script>
    (() => {
      
    const saveToLocal = {
      set: (key, value, ttl) => {
        if (!ttl) return
        const expiry = Date.now() + ttl * 86400000
        localStorage.setItem(key, JSON.stringify({ value, expiry }))
      },
      get: key => {
        const itemStr = localStorage.getItem(key)
        if (!itemStr) return undefined
        const { value, expiry } = JSON.parse(itemStr)
        if (Date.now() > expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return value
      }
    }

    window.btf = {
      saveToLocal,
      getScript: (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        Object.entries(attr).forEach(([key, val]) => script.setAttribute(key, val))
        script.onload = script.onreadystatechange = () => {
          if (!script.readyState || /loaded|complete/.test(script.readyState)) resolve()
        }
        script.onerror = reject
        document.head.appendChild(script)
      }),
      getCSS: (url, id) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onload = link.onreadystatechange = () => {
          if (!link.readyState || /loaded|complete/.test(link.readyState)) resolve()
        }
        link.onerror = reject
        document.head.appendChild(link)
      }),
      addGlobalFn: (key, fn, name = false, parent = window) => {
        if (!true && key.startsWith('pjax')) return
        const globalFn = parent.globalFn || {}
        globalFn[key] = globalFn[key] || {}
        if (name && globalFn[key][name]) return
        globalFn[key][name || Object.keys(globalFn[key]).length] = fn
        parent.globalFn = globalFn
      }
    }
  
      
      const activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      const activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }

      btf.activateDarkMode = activateDarkMode
      btf.activateLightMode = activateLightMode

      const theme = saveToLocal.get('theme')
    
          theme === 'dark' ? activateDarkMode() : theme === 'light' ? activateLightMode() : null
        
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        document.documentElement.classList.toggle('hide-aside', asideStatus === 'hide')
      }
    
      
    const detectApple = () => {
      if (/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)) {
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
  
    })()
  </script><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.json","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"未找到符合您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false,"highlightFullpage":false,"highlightMacStyle":true},
  copy: {
    success: '复制成功',
    error: '复制失败',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'null',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '自定義代碼配色',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2024-10-31 23:01:19'
}</script><meta name="generator" content="Hexo 7.3.0"><link rel="alternate" href="/atom.xml" title="Xing's Blog" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "/images/2.gif" data-lazy-src="/img/butterfly-icon.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">59</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">55</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-folder-open"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/shuoshuo/"><i class="fa-fw fas fa-folder-open"></i><span> 说说</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(https://oss.012700.xyz/butterfly/2024/09/CODE-COLOR-COVER.png);"><nav id="nav"><span id="blog-info"><a class="nav-site-title" href="/"><span class="site-name">Xing's Blog</span></a><a class="nav-page-title" href="/"><span class="site-name">自定義代碼配色</span></a></span><div id="menus"><div id="search-button"><span class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></span></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-folder-open"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/shuoshuo/"><i class="fa-fw fas fa-folder-open"></i><span> 说说</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><span class="site-page"><i class="fas fa-bars fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">自定義代碼配色</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-06-13T12:41:59.000Z" title="发表于 2020-06-13 20:41:59">2020-06-13</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-10-31T15:01:19.703Z" title="更新于 2024-10-31 23:01:19">2024-10-31</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E9%80%B2%E9%9A%8E%E6%95%99%E7%A8%8B/">進階教程</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title=""><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">浏览量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p>在<a target="_blank" rel="noopener" href="http://butterfly.js.org/posts/4aa8abbe/#%E4%BB%A3%E7%A2%BC%E9%AB%98%E4%BA%AE%E4%B8%BB%E9%A1%8C">Butterfly-安裝文檔-三-主題配置</a>中已經介紹瞭如何使用自定義代碼配色。</p>
<p>這篇文章是使用自定義代碼配色的實例教程。</p>
<h2 id="Highlight"><a href="#Highlight" class="headerlink" title="Highlight"></a>Highlight</h2><p>以使用<code>Kimbie dark</code>主題配色為例子</p>
<h3 id="配置hljs為true"><a href="#配置hljs為true" class="headerlink" title="配置hljs為true"></a>配置<code>hljs</code>為<code>true</code></h3><p>修改 Hexo 根目錄下的<code>_config.yml</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">highlight:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">line_number:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">auto_detect:</span> <span class="literal">false</span></span><br><span class="line">  <span class="attr">tab_replace:</span></span><br><span class="line">  <span class="attr">hljs:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure>

<h3 id="配置highlight-theme為false"><a href="#配置highlight-theme為false" class="headerlink" title="配置highlight_theme為false"></a>配置<code>highlight_theme</code>為<code>false</code></h3><p>修改<code>主題配置文件</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">highlight_theme:</span> <span class="literal">false</span></span><br></pre></td></tr></table></figure>

<h3 id="下載和修改-CSS-文件"><a href="#下載和修改-CSS-文件" class="headerlink" title="下載和修改 CSS 文件"></a>下載和修改 CSS 文件</h3><p>在<a target="_blank" rel="noopener" href="https://github.com/highlightjs/highlight.js/blob/master/src/styles/kimbie.dark.css">Github</a>上找到這個 CSS</p>
<p>在 Hexo 的根目錄<code>source</code>文件夾下創立一個<code>self</code>文件夾，在<code>self</code>文件夾創建一個<code>Kimbiedark.css</code>文件</p>
<p>把 Github 上<code>Kimbie dark</code>的 CSS 代碼複製到<code>Kimbiedark.css</code>去。（你也可以直接從 Github 上下載這個 CSS）</p>
<p><strong>Kimbiedark.css</strong>代碼如下</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">    Name:     Kimbie (dark)</span></span><br><span class="line"><span class="comment">    Author:   Jan T. Sott</span></span><br><span class="line"><span class="comment">    License:  Creative Commons Attribution-ShareAlike 4.0 Unported License</span></span><br><span class="line"><span class="comment">    URL:      https://github.com/idleberg/Kimbie-highlight.js</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Comment */</span></span><br><span class="line"><span class="selector-class">.hljs-comment</span>,</span><br><span class="line"><span class="selector-class">.hljs-quote</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#d6baad</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Red */</span></span><br><span class="line"><span class="selector-class">.hljs-variable</span>,</span><br><span class="line"><span class="selector-class">.hljs-template-variable</span>,</span><br><span class="line"><span class="selector-class">.hljs-tag</span>,</span><br><span class="line"><span class="selector-class">.hljs-name</span>,</span><br><span class="line"><span class="selector-class">.hljs-selector-id</span>,</span><br><span class="line"><span class="selector-class">.hljs-selector-class</span>,</span><br><span class="line"><span class="selector-class">.hljs-regexp</span>,</span><br><span class="line"><span class="selector-class">.hljs-meta</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#dc3958</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Orange */</span></span><br><span class="line"><span class="selector-class">.hljs-number</span>,</span><br><span class="line"><span class="selector-class">.hljs-built_in</span>,</span><br><span class="line"><span class="selector-class">.hljs-builtin-name</span>,</span><br><span class="line"><span class="selector-class">.hljs-literal</span>,</span><br><span class="line"><span class="selector-class">.hljs-type</span>,</span><br><span class="line"><span class="selector-class">.hljs-params</span>,</span><br><span class="line"><span class="selector-class">.hljs-deletion</span>,</span><br><span class="line"><span class="selector-class">.hljs-link</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#f79a32</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Yellow */</span></span><br><span class="line"><span class="selector-class">.hljs-title</span>,</span><br><span class="line"><span class="selector-class">.hljs-section</span>,</span><br><span class="line"><span class="selector-class">.hljs-attribute</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#f06431</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Green */</span></span><br><span class="line"><span class="selector-class">.hljs-string</span>,</span><br><span class="line"><span class="selector-class">.hljs-symbol</span>,</span><br><span class="line"><span class="selector-class">.hljs-bullet</span>,</span><br><span class="line"><span class="selector-class">.hljs-addition</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#889b4a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Purple */</span></span><br><span class="line"><span class="selector-class">.hljs-keyword</span>,</span><br><span class="line"><span class="selector-class">.hljs-selector-tag</span>,</span><br><span class="line"><span class="selector-class">.hljs-function</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#98676a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.hljs</span> &#123;</span><br><span class="line">  <span class="attribute">display</span>: block;</span><br><span class="line">  <span class="attribute">overflow-x</span>: auto;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#221a0f</span>;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#d3af86</span>;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0.5em</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.hljs-emphasis</span> &#123;</span><br><span class="line">  <span class="attribute">font-style</span>: italic;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.hljs-strong</span> &#123;</span><br><span class="line">  <span class="attribute">font-weight</span>: bold;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>修改這個 CSS 文件為</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">    Name:     Kimbie (dark)</span></span><br><span class="line"><span class="comment">    Author:   Jan T. Sott</span></span><br><span class="line"><span class="comment">    License:  Creative Commons Attribution-ShareAlike 4.0 Unported License</span></span><br><span class="line"><span class="comment">    URL:      https://github.com/idleberg/Kimbie-highlight.js</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/* 新添加的內容</span></span><br><span class="line"><span class="comment">  ------------------------------------- </span></span><br><span class="line"><span class="comment">  --hl-color                  代碼框字體顔色 【必須】 (把下面.hljs的 color複製到這裏來)</span></span><br><span class="line"><span class="comment">  --hl-bg                     代碼框背景色 【必須】 (把下面.hljs的 background複製到這裏來)</span></span><br><span class="line"><span class="comment">  --hltools-bg: #321a0f       代碼框頂部工具欄背景色 【可選】(如果你關掉了 copy、lang 和 shrink,可不用配置這個）</span></span><br><span class="line"><span class="comment">  --hltools-color: #fff       代碼框頂部工具欄字體顔色 【可選】(如果你關掉了 copy、lang 和 shrink,可不用配置這個）</span></span><br><span class="line"><span class="comment">  --hlnumber-bg: #221a0f      代碼框行數背景色 【可選】(如果已經關掉 line_number,可以不用配置這個)</span></span><br><span class="line"><span class="comment">  --hlnumber-color: #fff      代碼框行數字體顔色 【可選】 (如果已經關掉 line_number,可以不用配置這個)</span></span><br><span class="line"><span class="comment">  --hlscrollbar-bg: #d3af86   代碼框滾動條顔色 【可選】（默認為主題主顔色）</span></span><br><span class="line"><span class="comment">  --hlexpand-bg: #d3af86      代碼框底部展開背景色 【可選】(如果已經關掉 highlight_height_limit,可以不用配置這個)</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">:root</span> &#123;</span><br><span class="line">  <span class="attr">--hl-color</span>: <span class="number">#d3af86</span>;</span><br><span class="line">  <span class="attr">--hl-bg</span>: <span class="number">#221a0f</span>;</span><br><span class="line">  <span class="attr">--hltools-bg</span>: <span class="number">#321a0f</span>;</span><br><span class="line">  <span class="attr">--hltools-color</span>: <span class="number">#fff</span>;</span><br><span class="line">  <span class="attr">--hlnumber-bg</span>: <span class="number">#221a0f</span>;</span><br><span class="line">  <span class="attr">--hlnumber-color</span>: <span class="number">#fff</span>;</span><br><span class="line">  <span class="attr">--hlscrollbar-bg</span>: <span class="number">#d3af86</span>;</span><br><span class="line">  <span class="attr">--hlexpand-bg</span>: <span class="number">#d3af86</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Comment */</span></span><br><span class="line"><span class="selector-class">.hljs-comment</span>,</span><br><span class="line"><span class="selector-class">.hljs-quote</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#d6baad</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Red */</span></span><br><span class="line"><span class="selector-class">.hljs-variable</span>,</span><br><span class="line"><span class="selector-class">.hljs-template-variable</span>,</span><br><span class="line"><span class="selector-class">.hljs-tag</span>,</span><br><span class="line"><span class="selector-class">.hljs-name</span>,</span><br><span class="line"><span class="selector-class">.hljs-selector-id</span>,</span><br><span class="line"><span class="selector-class">.hljs-selector-class</span>,</span><br><span class="line"><span class="selector-class">.hljs-regexp</span>,</span><br><span class="line"><span class="selector-class">.hljs-meta</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#dc3958</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Orange */</span></span><br><span class="line"><span class="selector-class">.hljs-number</span>,</span><br><span class="line"><span class="selector-class">.hljs-built_in</span>,</span><br><span class="line"><span class="selector-class">.hljs-builtin-name</span>,</span><br><span class="line"><span class="selector-class">.hljs-literal</span>,</span><br><span class="line"><span class="selector-class">.hljs-type</span>,</span><br><span class="line"><span class="selector-class">.hljs-params</span>,</span><br><span class="line"><span class="selector-class">.hljs-deletion</span>,</span><br><span class="line"><span class="selector-class">.hljs-link</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#f79a32</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Yellow */</span></span><br><span class="line"><span class="selector-class">.hljs-title</span>,</span><br><span class="line"><span class="selector-class">.hljs-section</span>,</span><br><span class="line"><span class="selector-class">.hljs-attribute</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#f06431</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Green */</span></span><br><span class="line"><span class="selector-class">.hljs-string</span>,</span><br><span class="line"><span class="selector-class">.hljs-symbol</span>,</span><br><span class="line"><span class="selector-class">.hljs-bullet</span>,</span><br><span class="line"><span class="selector-class">.hljs-addition</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#889b4a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Kimbie Purple */</span></span><br><span class="line"><span class="selector-class">.hljs-keyword</span>,</span><br><span class="line"><span class="selector-class">.hljs-selector-tag</span>,</span><br><span class="line"><span class="selector-class">.hljs-function</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#98676a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* 更改的內容 把.hljs改為 #article-container figure.highlight .hljs *、</span></span><br><span class="line"><span class="comment">/* ------------------------------------- */</span></span><br><span class="line"><span class="selector-id">#article-container</span> <span class="selector-tag">figure</span><span class="selector-class">.highlight</span> <span class="selector-class">.hljs</span> &#123;</span><br><span class="line">  <span class="attribute">display</span>: block;</span><br><span class="line">  <span class="attribute">overflow-x</span>: auto;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#221a0f</span>;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#d3af86</span>;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0.5em</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.hljs-emphasis</span> &#123;</span><br><span class="line">  <span class="attribute">font-style</span>: italic;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.hljs-strong</span> &#123;</span><br><span class="line">  <span class="attribute">font-weight</span>: bold;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="引入文件"><a href="#引入文件" class="headerlink" title="引入文件"></a>引入文件</h3><p>修改<code>主題配置文件</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">inject:</span></span><br><span class="line">  <span class="attr">head:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">&lt;link</span> <span class="string">rel=&quot;stylesheet&quot;</span> <span class="string">href=&quot;/self/Kimbiedark.css&quot;&gt;</span></span><br></pre></td></tr></table></figure>

<h3 id="運行-Hexo"><a href="#運行-Hexo" class="headerlink" title="運行 Hexo"></a>運行 Hexo</h3><p>運行 Hexo 後，應該可以看到修改的效果</p>
<p><img src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/hexo-theme-butterfly-doc-highlight-self-css.png" alt="hexo-theme-butterfly-doc-highlight-self-css.png"></p>
<h2 id="Prismjs"><a href="#Prismjs" class="headerlink" title="Prismjs"></a>Prismjs</h2><p>以使用<code>prism-duotone-light</code>主題配色為例子</p>
<h3 id="配置highlight-theme為false-1"><a href="#配置highlight-theme為false-1" class="headerlink" title="配置highlight_theme為false"></a>配置<code>highlight_theme</code>為<code>false</code></h3><p>修改<code>主題配置文件</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">highlight_theme:</span> <span class="literal">false</span></span><br></pre></td></tr></table></figure>

<h3 id="下載和修改-CSS-文件-1"><a href="#下載和修改-CSS-文件-1" class="headerlink" title="下載和修改 CSS 文件"></a>下載和修改 CSS 文件</h3><p>在<a target="_blank" rel="noopener" href="https://github.com/PrismJS/prism-themes/blob/master/themes/prism-duotone-light.css">Github</a>上找到這個 CSS</p>
<p>在 Hexo 的根目錄<code>source</code>文件夾下創立一個<code>self</code>文件夾，在<code>self</code>文件夾創建一個<code>duotone.css</code>文件</p>
<p>把 Github 上<code>prism-duotone-light</code>的 CSS 代碼複製到&#96;&#96;duotone.css&#96;去。（你也可以直接從 Github 上下載這個 CSS）</p>
<p><strong>prism-duotone-light</strong>代碼如下</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">Name:   Duotone Light</span></span><br><span class="line"><span class="comment">Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes)</span></span><br><span class="line"><span class="comment"></span></span><br><span class="line"><span class="comment">Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-morning-light.css)</span></span><br><span class="line"><span class="comment">Generated with Base16 Builder (https://github.com/base16-builder/base16-builder)</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line"><span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span>,</span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">font-family</span>: Consolas, Menlo, Monaco, <span class="string">&#x27;Andale Mono WT&#x27;</span>, <span class="string">&#x27;Andale Mono&#x27;</span>, <span class="string">&#x27;Lucida Console&#x27;</span>, <span class="string">&#x27;Lucida Sans Typewriter&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;DejaVu Sans Mono&#x27;</span>, <span class="string">&#x27;Bitstream Vera Sans Mono&#x27;</span>, <span class="string">&#x27;Liberation Mono&#x27;</span>, <span class="string">&#x27;Nimbus Mono L&#x27;</span>, <span class="string">&#x27;Courier New&#x27;</span>, Courier,</span><br><span class="line">    monospace;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">14px</span>;</span><br><span class="line">  <span class="attribute">line-height</span>: <span class="number">1.375</span>;</span><br><span class="line">  <span class="attribute">direction</span>: ltr;</span><br><span class="line">  <span class="attribute">text-align</span>: left;</span><br><span class="line">  <span class="attribute">white-space</span>: pre;</span><br><span class="line">  <span class="attribute">word-spacing</span>: normal;</span><br><span class="line">  <span class="attribute">word-break</span>: normal;</span><br><span class="line"></span><br><span class="line">  -moz-<span class="attribute">tab-size</span>: <span class="number">4</span>;</span><br><span class="line">  -o-<span class="attribute">tab-size</span>: <span class="number">4</span>;</span><br><span class="line">  <span class="attribute">tab-size</span>: <span class="number">4</span>;</span><br><span class="line"></span><br><span class="line">  -webkit-<span class="attribute">hyphens</span>: none;</span><br><span class="line">  -moz-<span class="attribute">hyphens</span>: none;</span><br><span class="line">  -ms-<span class="attribute">hyphens</span>: none;</span><br><span class="line">  <span class="attribute">hyphens</span>: none;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#faf8f5</span>;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#728fcb</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre &gt; <span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">1em</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span>::-moz-selection,</span><br><span class="line">pre[class*=<span class="string">&#x27;language-&#x27;</span>] ::-moz-selection,</span><br><span class="line">code[class*=<span class="string">&#x27;language-&#x27;</span>]::-moz-selection,</span><br><span class="line">code[class*=<span class="string">&#x27;language-&#x27;</span>] ::-moz-selection &#123;</span><br><span class="line">  <span class="attribute">text-shadow</span>: none;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#faf8f5</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span><span class="selector-pseudo">::selection</span>,</span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> <span class="selector-pseudo">::selection</span>,</span><br><span class="line"><span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span><span class="selector-pseudo">::selection</span>,</span><br><span class="line"><span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> <span class="selector-pseudo">::selection</span> &#123;</span><br><span class="line">  <span class="attribute">text-shadow</span>: none;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#faf8f5</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Code blocks */</span></span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">1em</span>;</span><br><span class="line">  <span class="attribute">margin</span>: <span class="number">0.5em</span> <span class="number">0</span>;</span><br><span class="line">  <span class="attribute">overflow</span>: auto;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Inline code */</span></span><br><span class="line"><span class="selector-pseudo">:not</span>(pre) &gt; <span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0.1em</span>;</span><br><span class="line">  <span class="attribute">border-radius</span>: <span class="number">0.3em</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.comment</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.prolog</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.doctype</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.cdata</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#b6ad9a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.punctuation</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#b6ad9a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.namespace</span> &#123;</span><br><span class="line">  <span class="attribute">opacity</span>: <span class="number">0.7</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.tag</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.operator</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.number</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#063289</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.property</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.function</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#b29762</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.tag-id</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.selector</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.atrule-id</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#2d2006</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">code</span><span class="selector-class">.language-javascript</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.attr-name</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#896724</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">code</span><span class="selector-class">.language-css</span>,</span><br><span class="line"><span class="selector-tag">code</span><span class="selector-class">.language-scss</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.boolean</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.entity</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.url</span>,</span><br><span class="line"><span class="selector-class">.language-css</span> <span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.language-scss</span> <span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.style</span> <span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.attr-value</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.keyword</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.control</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.directive</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.unit</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.statement</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.regex</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.atrule</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#728fcb</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.placeholder</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.variable</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#93abdc</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.deleted</span> &#123;</span><br><span class="line">  <span class="attribute">text-decoration</span>: line-through;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.inserted</span> &#123;</span><br><span class="line">  <span class="attribute">border-bottom</span>: <span class="number">1px</span> dotted <span class="number">#2d2006</span>;</span><br><span class="line">  <span class="attribute">text-decoration</span>: none;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.italic</span> &#123;</span><br><span class="line">  <span class="attribute">font-style</span>: italic;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.important</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.bold</span> &#123;</span><br><span class="line">  <span class="attribute">font-weight</span>: bold;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.important</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#896724</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.entity</span> &#123;</span><br><span class="line">  <span class="attribute">cursor</span>: help;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre &gt; <span class="selector-tag">code</span><span class="selector-class">.highlight</span> &#123;</span><br><span class="line">  <span class="attribute">outline</span>: <span class="number">0.4em</span> solid <span class="number">#896724</span>;</span><br><span class="line">  <span class="attribute">outline-offset</span>: <span class="number">0.4em</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* overrides color-values for the Line Numbers plugin</span></span><br><span class="line"><span class="comment"> * http://prismjs.com/plugins/line-numbers/</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="selector-class">.line-numbers</span> <span class="selector-class">.line-numbers-rows</span> &#123;</span><br><span class="line">  <span class="attribute">border-right-color</span>: <span class="number">#ece8de</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.line-numbers-rows</span> &gt; <span class="selector-tag">span</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#cdc4b1</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* overrides color-values for the Line Highlight plugin</span></span><br><span class="line"><span class="comment"> * http://prismjs.com/plugins/line-highlight/</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="selector-class">.line-highlight</span> &#123;</span><br><span class="line">  <span class="attribute">background</span>: <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0.2</span>);</span><br><span class="line">  <span class="attribute">background</span>: <span class="built_in">-webkit-linear-gradient</span>(left, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0.2</span>) <span class="number">70%</span>, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0</span>));</span><br><span class="line">  <span class="attribute">background</span>: <span class="built_in">linear-gradient</span>(to right, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0.2</span>) <span class="number">70%</span>, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0</span>));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>修改這個 CSS 文件為</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* 新添加的內容</span></span><br><span class="line"><span class="comment">  ------------------------------------- </span></span><br><span class="line"><span class="comment">  --hl-color                  代碼框字體顔色 【必須】 (把下面 pre[class*=&quot;language-&quot;]的 color 複製到這裏來)</span></span><br><span class="line"><span class="comment">  --hl-bg                     代碼框背景色 【必須】 (把下面 pre[class*=&quot;language-&quot;]的 background複製到這裏來)</span></span><br><span class="line"><span class="comment">  --hltools-bg: #321a0f       代碼框頂部工具欄背景色 【可選】(如果你關掉了 copy、lang 和 shrink,可不用配置這個）</span></span><br><span class="line"><span class="comment">  --hltools-color: #fff       代碼框頂部工具欄字體顔色 【可選】(如果你關掉了 copy、lang 和 shrink,可不用配置這個）</span></span><br><span class="line"><span class="comment">  --hlnumber-bg: #221a0f      代碼框行數背景色 【可選】(如果已經關掉 line_number,可以不用配置這個)</span></span><br><span class="line"><span class="comment">  --hlnumber-color: #fff      代碼框行數字體顔色 【可選】 (如果已經關掉 line_number,可以不用配置這個)</span></span><br><span class="line"><span class="comment">  --hlscrollbar-bg: #d3af86   代碼框滾動條顔色 【可選】（默認為主題主顔色）</span></span><br><span class="line"><span class="comment">  --hlexpand-bg: #d3af86      代碼框底部展開背景色 【可選】(如果已經關掉 highlight_height_limit,可以不用配置這個)</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line"><span class="selector-pseudo">:root</span> &#123;</span><br><span class="line">  <span class="attr">--hl-color</span>: <span class="number">#728fcb</span>;</span><br><span class="line">  <span class="attr">--hl-bg</span>: <span class="number">#faf8f5</span>;</span><br><span class="line">  <span class="attr">--hltools-bg</span>: xxxxxxx;</span><br><span class="line">  <span class="attr">--hltools-color</span>: xxxxxxx;</span><br><span class="line">  <span class="attr">--hlnumber-bg</span>: xxxxxxx;</span><br><span class="line">  <span class="attr">--hlnumber-color</span>: xxxxxxxx;</span><br><span class="line">  <span class="attr">--hlscrollbar-bg</span>: xxxxx;</span><br><span class="line">  <span class="attr">--hlexpand-bg</span>: xxxxxxx;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* ------------------------------------- */</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/* 這些可以刪除（可留着，如果有衝突，請刪除） */</span></span><br><span class="line"><span class="comment">/* ------------------------------------- */</span></span><br><span class="line"><span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span>,</span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">font-family</span>: Consolas, Menlo, Monaco, <span class="string">&#x27;Andale Mono WT&#x27;</span>, <span class="string">&#x27;Andale Mono&#x27;</span>, <span class="string">&#x27;Lucida Console&#x27;</span>, <span class="string">&#x27;Lucida Sans Typewriter&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;DejaVu Sans Mono&#x27;</span>, <span class="string">&#x27;Bitstream Vera Sans Mono&#x27;</span>, <span class="string">&#x27;Liberation Mono&#x27;</span>, <span class="string">&#x27;Nimbus Mono L&#x27;</span>, <span class="string">&#x27;Courier New&#x27;</span>, Courier,</span><br><span class="line">    monospace;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">14px</span>;</span><br><span class="line">  <span class="attribute">line-height</span>: <span class="number">1.375</span>;</span><br><span class="line">  <span class="attribute">direction</span>: ltr;</span><br><span class="line">  <span class="attribute">text-align</span>: left;</span><br><span class="line">  <span class="attribute">white-space</span>: pre;</span><br><span class="line">  <span class="attribute">word-spacing</span>: normal;</span><br><span class="line">  <span class="attribute">word-break</span>: normal;</span><br><span class="line"></span><br><span class="line">  -moz-<span class="attribute">tab-size</span>: <span class="number">4</span>;</span><br><span class="line">  -o-<span class="attribute">tab-size</span>: <span class="number">4</span>;</span><br><span class="line">  <span class="attribute">tab-size</span>: <span class="number">4</span>;</span><br><span class="line"></span><br><span class="line">  -webkit-<span class="attribute">hyphens</span>: none;</span><br><span class="line">  -moz-<span class="attribute">hyphens</span>: none;</span><br><span class="line">  -ms-<span class="attribute">hyphens</span>: none;</span><br><span class="line">  <span class="attribute">hyphens</span>: none;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#faf8f5</span>;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#728fcb</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre &gt; <span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">1em</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span>::-moz-selection,</span><br><span class="line">pre[class*=<span class="string">&#x27;language-&#x27;</span>] ::-moz-selection,</span><br><span class="line">code[class*=<span class="string">&#x27;language-&#x27;</span>]::-moz-selection,</span><br><span class="line">code[class*=<span class="string">&#x27;language-&#x27;</span>] ::-moz-selection &#123;</span><br><span class="line">  <span class="attribute">text-shadow</span>: none;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#faf8f5</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span><span class="selector-pseudo">::selection</span>,</span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> <span class="selector-pseudo">::selection</span>,</span><br><span class="line"><span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span><span class="selector-pseudo">::selection</span>,</span><br><span class="line"><span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> <span class="selector-pseudo">::selection</span> &#123;</span><br><span class="line">  <span class="attribute">text-shadow</span>: none;</span><br><span class="line">  <span class="attribute">background</span>: <span class="number">#faf8f5</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Code blocks */</span></span><br><span class="line">pre<span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">1em</span>;</span><br><span class="line">  <span class="attribute">margin</span>: <span class="number">0.5em</span> <span class="number">0</span>;</span><br><span class="line">  <span class="attribute">overflow</span>: auto;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* Inline code */</span></span><br><span class="line"><span class="selector-pseudo">:not</span>(pre) &gt; <span class="selector-tag">code</span><span class="selector-attr">[class*=<span class="string">&#x27;language-&#x27;</span>]</span> &#123;</span><br><span class="line">  <span class="attribute">padding</span>: <span class="number">0.1em</span>;</span><br><span class="line">  <span class="attribute">border-radius</span>: <span class="number">0.3em</span>;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">/* ------------------------------------- */</span></span><br><span class="line"><span class="comment">/* 到這裏為止，可以刪除 */</span></span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.comment</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.prolog</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.doctype</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.cdata</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#b6ad9a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.punctuation</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#b6ad9a</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.namespace</span> &#123;</span><br><span class="line">  <span class="attribute">opacity</span>: <span class="number">0.7</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.tag</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.operator</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.number</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#063289</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.property</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.function</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#b29762</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.tag-id</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.selector</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.atrule-id</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#2d2006</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">code</span><span class="selector-class">.language-javascript</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.attr-name</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#896724</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">code</span><span class="selector-class">.language-css</span>,</span><br><span class="line"><span class="selector-tag">code</span><span class="selector-class">.language-scss</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.boolean</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.entity</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.url</span>,</span><br><span class="line"><span class="selector-class">.language-css</span> <span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.language-scss</span> <span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.style</span> <span class="selector-class">.token</span><span class="selector-class">.string</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.attr-value</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.keyword</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.control</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.directive</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.unit</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.statement</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.regex</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.atrule</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#728fcb</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.placeholder</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.variable</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#93abdc</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.deleted</span> &#123;</span><br><span class="line">  <span class="attribute">text-decoration</span>: line-through;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.inserted</span> &#123;</span><br><span class="line">  <span class="attribute">border-bottom</span>: <span class="number">1px</span> dotted <span class="number">#2d2006</span>;</span><br><span class="line">  <span class="attribute">text-decoration</span>: none;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.italic</span> &#123;</span><br><span class="line">  <span class="attribute">font-style</span>: italic;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.important</span>,</span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.bold</span> &#123;</span><br><span class="line">  <span class="attribute">font-weight</span>: bold;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.important</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#896724</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.token</span><span class="selector-class">.entity</span> &#123;</span><br><span class="line">  <span class="attribute">cursor</span>: help;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">pre &gt; <span class="selector-tag">code</span><span class="selector-class">.highlight</span> &#123;</span><br><span class="line">  <span class="attribute">outline</span>: <span class="number">0.4em</span> solid <span class="number">#896724</span>;</span><br><span class="line">  <span class="attribute">outline-offset</span>: <span class="number">0.4em</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* overrides color-values for the Line Numbers plugin</span></span><br><span class="line"><span class="comment"> * http://prismjs.com/plugins/line-numbers/</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="selector-class">.line-numbers</span> <span class="selector-class">.line-numbers-rows</span> &#123;</span><br><span class="line">  <span class="attribute">border-right-color</span>: <span class="number">#ece8de</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="selector-class">.line-numbers-rows</span> &gt; <span class="selector-tag">span</span><span class="selector-pseudo">:before</span> &#123;</span><br><span class="line">  <span class="attribute">color</span>: <span class="number">#cdc4b1</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/* overrides color-values for the Line Highlight plugin</span></span><br><span class="line"><span class="comment"> * http://prismjs.com/plugins/line-highlight/</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="selector-class">.line-highlight</span> &#123;</span><br><span class="line">  <span class="attribute">background</span>: <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0.2</span>);</span><br><span class="line">  <span class="attribute">background</span>: <span class="built_in">-webkit-linear-gradient</span>(left, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0.2</span>) <span class="number">70%</span>, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0</span>));</span><br><span class="line">  <span class="attribute">background</span>: <span class="built_in">linear-gradient</span>(to right, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0.2</span>) <span class="number">70%</span>, <span class="built_in">rgba</span>(<span class="number">45</span>, <span class="number">32</span>, <span class="number">6</span>, <span class="number">0</span>));</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="引入文件-1"><a href="#引入文件-1" class="headerlink" title="引入文件"></a>引入文件</h3><p>修改<code>主題配置文件</code></p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">inject:</span></span><br><span class="line">  <span class="attr">head:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">&lt;link</span> <span class="string">rel=&quot;stylesheet&quot;</span> <span class="string">href=&quot;/self/duotone.css&quot;&gt;</span></span><br></pre></td></tr></table></figure>

<h3 id="運行-Hexo-1"><a href="#運行-Hexo-1" class="headerlink" title="運行 Hexo"></a>運行 Hexo</h3><p>運行 Hexo 後，應該可以看到修改的效果</p>
<p><img src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/butterfly-custom-code-color-prismjs.png" alt="butterfly-custom-code-color-prismjs.png"></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://veryXing.github.io">xing</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://veryxing.github.io/article/b37b5fe3.html">https://veryxing.github.io/article/b37b5fe3.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来源 <a href="https://veryXing.github.io" target="_blank">Xing's Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E6%95%99%E7%A8%8B/">教程</a><a class="post-meta__tags" href="/tags/Hexo/">Hexo</a><a class="post-meta__tags" href="/tags/%E4%B8%BB%E9%A1%8C/">主題</a><a class="post-meta__tags" href="/tags/butterfly/">butterfly</a></div><div class="post-share"><div class="social-share" data-image="https://oss.012700.xyz/butterfly/2024/09/CODE-COLOR-COVER.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><a class="prev-post pull-left" href="/article/3bd898ff.html" title="Butterfly添加全局吸底Aplayer教程"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/Butterfly-add-aplayer-cover.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Butterfly添加全局吸底Aplayer教程</div></div></a><a class="next-post pull-right" href="/article/fa36e355.html" title="Butterfly 文檔(六) 進階教程"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/butterfly-docs-06-cover.png" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Butterfly 文檔(六) 進階教程</div></div></a></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><a href="/article/70021e6e.html" title="Butterfly 文檔(一) 快速開始"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/butterfly-docs-01-cover.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-28</div><div class="title">Butterfly 文檔(一) 快速開始</div></div></a><a href="/article/405e153.html" title="Butterfly 文檔(五) 主題問答"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/butterfly-doc-05-cover.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-28</div><div class="title">Butterfly 文檔(五) 主題問答</div></div></a><a href="/article/6b50bc45.html" title="Butterfly 文檔(二) 主題頁面"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/Butterfly-docs-02-cover.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-28</div><div class="title">Butterfly 文檔(二) 主題頁面</div></div></a><a href="/article/fa36e355.html" title="Butterfly 文檔(六) 進階教程"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/butterfly-docs-06-cover.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-28</div><div class="title">Butterfly 文檔(六) 進階教程</div></div></a><a href="/article/3bd898ff.html" title="Butterfly添加全局吸底Aplayer教程"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/Butterfly-add-aplayer-cover.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-07-31</div><div class="title">Butterfly添加全局吸底Aplayer教程</div></div></a><a href="/article/a2c7de2.html" title="Butterfly 文檔(三) 主題配置"><img class="cover" src= "/images/2.gif" data-lazy-src="https://oss.012700.xyz/butterfly/2024/09/butterfly-docs-03-cover.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-05-28</div><div class="title">Butterfly 文檔(三) 主題配置</div></div></a></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info is-center"><div class="avatar-img"><img src= "/images/2.gif" data-lazy-src="/img/butterfly-icon.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info-name">xing</div><div class="author-info-description"></div><div class="site-data"><a href="/archives/"><div class="headline">文章</div><div class="length-num">59</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">55</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/veryXing"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Highlight"><span class="toc-number">1.</span> <span class="toc-text">Highlight</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEhljs%E7%82%BAtrue"><span class="toc-number">1.1.</span> <span class="toc-text">配置hljs為true</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEhighlight-theme%E7%82%BAfalse"><span class="toc-number">1.2.</span> <span class="toc-text">配置highlight_theme為false</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%8B%E8%BC%89%E5%92%8C%E4%BF%AE%E6%94%B9-CSS-%E6%96%87%E4%BB%B6"><span class="toc-number">1.3.</span> <span class="toc-text">下載和修改 CSS 文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BC%95%E5%85%A5%E6%96%87%E4%BB%B6"><span class="toc-number">1.4.</span> <span class="toc-text">引入文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%81%8B%E8%A1%8C-Hexo"><span class="toc-number">1.5.</span> <span class="toc-text">運行 Hexo</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Prismjs"><span class="toc-number">2.</span> <span class="toc-text">Prismjs</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AEhighlight-theme%E7%82%BAfalse-1"><span class="toc-number">2.1.</span> <span class="toc-text">配置highlight_theme為false</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%8B%E8%BC%89%E5%92%8C%E4%BF%AE%E6%94%B9-CSS-%E6%96%87%E4%BB%B6-1"><span class="toc-number">2.2.</span> <span class="toc-text">下載和修改 CSS 文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%BC%95%E5%85%A5%E6%96%87%E4%BB%B6-1"><span class="toc-number">2.3.</span> <span class="toc-text">引入文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%81%8B%E8%A1%8C-Hexo-1"><span class="toc-number">2.4.</span> <span class="toc-text">運行 Hexo</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/article/18647ffa.html" title="pytest-qt 测试模态窗体."><img src= "/images/2.gif" data-lazy-src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="pytest-qt 测试模态窗体."/></a><div class="content"><a class="title" href="/article/18647ffa.html" title="pytest-qt 测试模态窗体.">pytest-qt 测试模态窗体.</a><time datetime="2024-11-27T17:01:35.284Z" title="发表于 2024-11-28 01:01:35">2024-11-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/article/5a8a6c8d.html" title="post"><img src= "/images/2.gif" data-lazy-src="http://up.36992.com/pic/e6/c5/51/e6c551e768092c8655292d89a4034a74.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="post"/></a><div class="content"><a class="title" href="/article/5a8a6c8d.html" title="post">post</a><time datetime="2024-10-31T15:27:17.000Z" title="发表于 2024-10-31 23:27:17">2024-10-31</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/article/140ab620.html" title="某网站自动下载音乐mp3和歌词"><img src= "/images/2.gif" data-lazy-src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-6.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="某网站自动下载音乐mp3和歌词"/></a><div class="content"><a class="title" href="/article/140ab620.html" title="某网站自动下载音乐mp3和歌词">某网站自动下载音乐mp3和歌词</a><time datetime="2024-10-31T12:15:16.000Z" title="发表于 2024-10-31 20:15:16">2024-10-31</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/article/32b656da.html" title="PyQt密码管理系统"><img src= "/images/2.gif" data-lazy-src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-2.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="PyQt密码管理系统"/></a><div class="content"><a class="title" href="/article/32b656da.html" title="PyQt密码管理系统">PyQt密码管理系统</a><time datetime="2024-10-20T14:36:18.000Z" title="发表于 2024-10-20 22:36:18">2024-10-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/article/a0a0fd82.html" title="PyQt5实现桌面小宠物"><img src= "/images/2.gif" data-lazy-src="https://jsd.012700.xyz/gh/jerryc127/CDN/img/material-9.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="PyQt5实现桌面小宠物"/></a><div class="content"><a class="title" href="/article/a0a0fd82.html" title="PyQt5实现桌面小宠物">PyQt5实现桌面小宠物</a><time datetime="2024-10-20T14:28:05.000Z" title="发表于 2024-10-20 22:28:05">2024-10-20</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2024 By xing</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="日间和夜间模式切换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><div class="js-pjax"></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="true" data-click="false"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>(() => {
  const pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]

  window.pjax = new Pjax({
    elements: 'a:not([target="_blank"])',
    selectors: pjaxSelectors,
    cacheBust: false,
    analytics: false,
    scrollRestoration: false
  })

  const triggerPjaxFn = (val) => {
    if (!val) return
    Object.values(val).forEach(fn => fn())
  }

  document.addEventListener('pjax:send', () => {
    // removeEventListener
    btf.removeGlobalFnEvent('pjaxSendOnce')
    btf.removeGlobalFnEvent('themeChange')

    // reset readmode
    const $bodyClassList = document.body.classList
    if ($bodyClassList.contains('read-mode')) $bodyClassList.remove('read-mode')

    triggerPjaxFn(window.globalFn.pjaxSend)
  })

  document.addEventListener('pjax:complete', () => {
    btf.removeGlobalFnEvent('pjaxCompleteOnce')
    document.querySelectorAll('script[data-pjax]').forEach(item => {
      const newScript = document.createElement('script')
      const content = item.text || item.textContent || item.innerHTML || ""
      Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
      newScript.appendChild(document.createTextNode(content))
      item.parentNode.replaceChild(newScript, item)
    })

    triggerPjaxFn(window.globalFn.pjaxComplete)
  })

  document.addEventListener('pjax:error', e => {
    if (e.request.status === 404) {
      pjax.loadUrl('/404.html')
    }
  })
})()</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div></body></html>